#ifndef GT_INTERRUPTER_H
#define GT_INTERRUPTER_H

#include <Windows.h>

namespace geterns{

const DWORD Sec = 1000UL;

class interrupter{

private:

	// private data
	HANDLE	target_thread;
	HANDLE	back_thread;
	DWORD	time_interval;

	void (*callback)();

	// disable this functions
	interrupter(const interrupter &);
	interrupter &operator=(const interrupter &);

private:

	// for back thread
	static DWORD WINAPI back_thread_routine(LPVOID p);

public:

	// 
	interrupter(const DWORD t, void (*f)());

	//
	~interrupter();

	//
	bool start();

	//
	bool cancel();

}; // class interrupter

} // namespace geterns

#endif
